﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="list.aspx.cs" Inherits="Prototype.list" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="server">
<asp:GridView ID="grdArticleList" runat="server" DataSourceID="AutoFixDataSource" AllowSorting="True" AutoGenerateColumns="False" CssClass="grid">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:HyperLink ID="lnkArticleDetails" runat="server" NavigateUrl='<%# Eval("ArticleID","details.aspx?aID={0}") %>'><asp:Image ID="imgArticleImage" runat="server" ImageUrl='<%#Eval("ArticleImageUrl") %>' CssClass="article-image-cover"/></asp:HyperLink>
            </ItemTemplate>
            <HeaderStyle CssClass="grid-header" />
            <ItemStyle CssClass="grid-column" />
        </asp:TemplateField>
        <asp:HyperLinkField DataNavigateUrlFields="ArticleID" DataNavigateUrlFormatString="details.aspx?aID={0}" DataTextField="ArticleName" HeaderText="Article Name" SortExpression="ArticleName" >
        <HeaderStyle CssClass="grid-header" />
        <ItemStyle CssClass="grid-column" />
        </asp:HyperLinkField>
        <asp:BoundField DataField="UserName" HeaderText="Written By" SortExpression="UserName" >
        <HeaderStyle CssClass="grid-header" />
        <ItemStyle CssClass="grid-column" />
        </asp:BoundField>
    </Columns>
    </asp:GridView>
    
    <asp:SqlDataSource ID="AutoFixDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:AutoFixConnectionString %>" ProviderName="<%$ ConnectionStrings:AutoFixConnectionString.ProviderName %>" SelectCommand="SELECT Article.ArticleName, Article.ArticleImageUrl, ApplicationUser.UserName, Article.ArticleID, Step.StepURL
FROM (Article INNER JOIN ApplicationUser ON Article.UserID =  ApplicationUser.UserID) INNER JOIN Step ON Article.ArticleID = Step.ArticleID">
    </asp:SqlDataSource>
    
</asp:Content>
